<%@ page language="java" import="java.util.*,entity.*,dao.*,dao.impl.*" pageEncoding="utf-8"%>
 <%
  	request.setCharacterEncoding("utf-8");
  	String title=request.getParameter("title");
  	String content=request.getParameter("content");
  	TopicDao topicDao = new TopicDaoImpl();
  	User user =(User)session.getAttribute("user");
  	
  	int boardId = Integer.parseInt(request.getParameter("boardId"));
  	if(user != null){
  		Topic topic=new Topic();
  		topic.setTitle(title);
  		topic.setContent(content);
  		topic.setBoardId(boardId);
  		topic.setUid(user.getUId());
  		topicDao.addTopic(topic);
  		response.sendRedirect("../list.jsp?page=1&boardId="+boardId);
  	}else{
  		response.sendRedirect("../login.jsp");
  	}	
 %>

